package com.jinxin.platform.cdysylives.controller;

import com.jinxin.platform.cdysylives.bean.bo.AppKeySecretInfo;
import com.jinxin.platform.cdysylives.common.ResultEntity;
import com.jinxin.platform.cdysylives.service.IAccesstokenService;
import com.jinxin.platform.cdysylives.service.IEquipmentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * All rights Reserved, Designed By www.beonelot.com
 *
 * @version: V1.0
 * @Copyright: www.beonelot.com Inc. All rights reserved.
 * @Description：
 * @Date: 2021-03-12
 * @Author: Lingnan
 **/
@RestController
@RequestMapping("/unAuth/cdys7lives")
@Slf4j
public class YsyController {
    @Autowired
    private IAccesstokenService accesstokenService;
    @Autowired
    private IEquipmentService equipmentService;

    @PostMapping("/saveAkInfo")
    public ResultEntity saveAkInfo(AppKeySecretInfo appKeySecretInfo){
        return accesstokenService.saveOrUpdateKey(appKeySecretInfo);
    }
    @GetMapping("/getAkInfoByUser")
    public ResultEntity getAkInfoByUser(){
        return accesstokenService.getAkInfoByUser();
    }

    @RequestMapping("/listDevice")
    public Map<String,Object> listDevice(){
        return equipmentService.listDevices();
    }

    @GetMapping("/getLiveAddress")
    public ResultEntity getLiveAddress(String deviceSerial,String quality){
        return equipmentService.getVideoAddress(deviceSerial,quality);
    }
}
